﻿<%@ WebHandler Language="C#" Class="NewsTitleLikeCount" %>

using System;
using System.Web;

public class NewsTitleLikeCount : IHttpHandler {
    
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/plain";
        string key = context.Request.QueryString["key"];
        string table = context.Request.QueryString["tab"];
        string col = context.Request.QueryString["col"];
        string id = context.Request.QueryString["id"];
        if (string.IsNullOrEmpty(key))
        {
            context.Response.Write(0);
        }
        else
        {
            string sql = "select count(*) from freetexttable(" + table + "," + col + ",'" + key.ToSql() + "')";
            if (id != "0")
            {
                sql += " where [key]<>" + id;
            }
            int cnt = int.Parse(DBFactory.GetConn().exe1(sql));
            context.Response.Write(cnt);
        }
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}